package Web.Request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

    @WebServlet("/RequestDemo6")
public class RequestDemo6 extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("demo6...");

        //存储数据到request域中
        req.setAttribute("msg" ,"hello");
        //转发到7的资源
       /* RequestDispatcher requestDispatcher = req.getRequestDispatcher("/RequestDemo7");
        requestDispatcher.forward(req,resp);*/
        req.getRequestDispatcher("/RequestDemo7").forward(req,resp);

    }

        @Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            this.doPost(req, resp);
        }


}
